#include <iostream>
#include <string>
#include <sstream>

#include "SimulationData.h"

SimulationData::SimulationData(const unsigned int rid)
{
    stringstream filename;
    filename << DataFolder<<"/Robot_" << rid << ".dat";

    file.open(filename.str().c_str());
    lastLogTime = 0;
}

void SimulationData::LogWithTime(const string Record, const unsigned int Seconds)
{
    lastLogTime = Seconds;

    file << Record << endl;
    file.flush();
}

void SimulationData::LogWithTime(int robotId, int groupSize, int communication, unsigned int seconds)
{
    stringstream record;
    record<<"[Time "<<seconds<<"][Robot "<<robotId<<"][GroupSize "<<groupSize<<"][Communication "<<communication<<"]"<<endl;
    LogWithTime(record.str(), seconds);
}
